{include file="header.tpl"}

{literal}
<script language="JavaScript" >
<!--
function isEmail( str ){  

	var myReg = /^[-_A-Za-z0-9]+@([_A-Za-z0-9]+\.)+[A-Za-z0-9]{2,3}$/; 
	
	if(myReg.test(str)) return true; 
	
	return false; 

}


function validateRegForm() {  
  
	var errors='';

	Rename = document.getElementById('seller_logaccount').value;
	if(!Rename)  errors='- 商家登录账号不能为空！\n';
	 
	Reaccount = REG.elements['seller_logaccount'];
	if(!Reaccount.value) errors+='- 你必须设置一个登陆名！\n'; 
	 
	Repasswd = REG.elements['seller_password'];
	if(!Repasswd.value || Repasswd.value.length < 6) errors+='- 你需要一个登陆密码且长度大于6个字符！\n';
	
	Rerepasswd = REG.elements['repassword'];
	if( Repasswd.value != Rerepasswd.value)  errors+='- 两次登陆密码不符！\n';
	 
	Tele = REG.elements['seller_telephone'];
	if(isNaN(Tele.value) || !Tele.value){
	      errors+='- 电话号码必须是数字\n';
	}
	 
	Remail = REG.elements['seller_email_address'];
	if(!(Remail.value) || !isEmail(Remail.value)){
	    errors+='- Email必填且必需为合法Email地址!\n';
	}
	 
	qq = REG.elements['seller_qq_number'];
	if (isNaN(qq.value)){
		errors+='- QQ号码必须是数字！\n';
	}
	
	if (errors) alert('发生了如下错误:\n'+errors);

	return (errors == '');
}
// password strength check
function PasswordStrength(showed){	
	this.showed = (typeof(showed) == "boolean")?showed:true;
	this.styles = new Array();	
	this.styles[0] = {backgroundColor:"#EBEBEB",borderLeft:"solid 1px #FFFFFF",borderRight:"solid 1px #BEBEBE",borderBottom:"solid 1px #BEBEBE"};	
	this.styles[1] = {backgroundColor:"#FF4545",borderLeft:"solid 1px #FFFFFF",borderRight:"solid 1px #BB2B2B",borderBottom:"solid 1px #BB2B2B"};
	this.styles[2] = {backgroundColor:"#FFD35E",borderLeft:"solid 1px #FFFFFF",borderRight:"solid 1px #E9AE10",borderBottom:"solid 1px #E9AE10"};
	this.styles[3] = {backgroundColor:"#95EB81",borderLeft:"solid 1px #FFFFFF",borderRight:"solid 1px #3BBC1B",borderBottom:"solid 1px #3BBC1B"};
	
	this.labels= ["弱","中","强"];

	this.divName = "pwd_div_"+Math.ceil(Math.random()*100000);
	this.minLen = 5;
	
	this.width = "150px";
	this.height = "16px";
	
	this.content = "";
	
	this.selectedIndex = 0;
	
	this.init();	
}
PasswordStrength.prototype.init = function(){
	var s = '<table cellpadding="0" id="'+this.divName+'_table" cellspacing="0" style="width:'+this.width+';height:'+this.height+';">';
	s += '<tr>';
	for(var i=0;i<3;i++){
		s += '<td id="'+this.divName+'_td_'+i+'" width="33%" align="center"><span style="font-size:1px">&nbsp;</span><span id="'+this.divName+'_label_'+i+'" style="display:none;font-family: Courier New, Courier, mono;font-size: 12px;color: #000000;">'+this.labels[i]+'</span></td>';
	}	
	s += '</tr>';
	s += '</table>';
	this.content = s;
	if(this.showed){
		document.write(s);
		this.copyToStyle(this.selectedIndex);
	}	
}
PasswordStrength.prototype.copyToObject = function(o1,o2){
	for(var i in o1){
		o2[i] = o1[i];
	}
}
PasswordStrength.prototype.copyToStyle = function(id){
	this.selectedIndex = id;
	for(var i=0;i<3;i++){
		if(i == id-1){
			this.$(this.divName+"_label_"+i).style.display = "inline";
		}else{
			this.$(this.divName+"_label_"+i).style.display = "none";
		}
	}
	for(var i=0;i<id;i++){
		this.copyToObject(this.styles[id],this.$(this.divName+"_td_"+i).style);			
	}
	for(;i<3;i++){
		this.copyToObject(this.styles[0],this.$(this.divName+"_td_"+i).style);
	}
}
PasswordStrength.prototype.$ = function(s){
	return document.getElementById(s);
}
PasswordStrength.prototype.setSize = function(w,h){
	this.width = w;
	this.height = h;
}
PasswordStrength.prototype.setMinLength = function(n){
	if(isNaN(n)){
		return ;
	}
	n = Number(n);
	if(n>1){
		this.minLength = n;
	}
}
PasswordStrength.prototype.setStyles = function(){
	if(arguments.length == 0){
		return ;
	}
	for(var i=0;i<arguments.length && i < 4;i++){
		this.styles[i] = arguments[i];
	}
	this.copyToStyle(this.selectedIndex);
}
PasswordStrength.prototype.write = function(s){
	if(this.showed){
		return ;
	}
	var n = (s == 'string') ? this.$(s) : s;
	if(typeof(n) != "object"){
		return ;
	}
	n.innerHTML = this.content;
	this.copyToStyle(this.selectedIndex);
}
PasswordStrength.prototype.update = function(s){
	if(s.length < this.minLen){
		this.copyToStyle(0);
		return;
	}
	var ls = -1;
	if (s.match(/[a-z]/ig)){
		ls++;
	}
	if (s.match(/[0-9]/ig)){
		ls++;
	}
 	if (s.match(/(.[^a-z0-9])/ig)){
		ls++;
	}
	if (s.length < 6 && ls > 0){
		ls--;
	}
	 switch(ls) { 
		 case 0:
			 this.copyToStyle(1);
			 break;
		 case 1:
			 this.copyToStyle(2);
			 break;
		 case 2:
			 this.copyToStyle(3);
			 break;
		 default:
			 this.copyToStyle(0);
	 }
}
     
//-->
</script>
{/literal}
<body bgcolor="#ffffff">
{$xajax_javascript}
{if $code eq "00"}
 <table width="98%" cellspacing=0 cellpadding=0 align=center>
   <tr>
     <td align=left> <b><A href="{$index_url}"><img src='{#t_images#}navi.gif' border=0 alt="">{$html_title}</A>&gt;&gt; 注册表单</b></td>
   </tr>
 </table>
 <table width="100%">
   <TR align=center bgcolor="#FFFFFF">
     <TD height="1"></TD>
   </TR>
 </TABLE>
 <form name="REG" action="" method="post" onSubmit="return validateRegForm(REG);">   
   <table width="98%"  border="0" align="center" cellspacing=1 cellpadding=3 bgcolor=#E7E3E7>
     <tr>
       <td colspan="3" class="head">注册程序</td>
     </tr>
     <tr>
       <td class='f_one'>登陆账号<font color=red>*</font></td>
       <td width="20%" class='f_one'><input name="reg[seller_logaccount]" type="text" class="form" id="seller_logaccount"> <div id="message"></div> </td>
       <td width="62%" class='f_one'><strong><font color="#FF0000">
         <input type="button" name="Submit2" value="检查帐号" class="input1"  onClick="xajax_checkuser(document.getElementById('seller_logaccount').value)"/>
       <span class="red">纯字母数字或下划线组成。好名有利别人记忆</span></font></strong></td>
     </tr>
     <tr>
       <td width="18%" class='f_one'>会员性别</td>
       <td colspan="2" class='f_one'><input name="reg[seller_gender]" type="radio" value="male" checked>
      帅哥
        <input type="radio" name="reg[seller_gender]" value="female">
      美女</td>
     </tr>
     <tr>
       <td class='f_one'>登陆密码<font color=red>*</font></td>
       <td colspan="2" class='f_one'>       <input name="reg[seller_password]" maxLength=12 type="password" class="form" id="seller_password" onKeyUp="ps.update(this.value);">密码(至少6位)：</B>请输入密码，区分大小写。请尽量设得复杂一些，以防被人暴力猜解。</td>
     </tr>
     <tr>
       <td class='f_one'>强度显示<font color=red>*</font></td>
       <td colspan="2" class='f_one'><script language="javascript">
										var ps = new PasswordStrength();
										//设置显示大小；
										ps.setSize("200","20");
										//设置最少检测字符长度；
										ps.setMinLength(6);
									</script>
       </td>
     </tr>
     <tr>
       <td class='f_one'>重复密码<font color=red>*</font></td>
       <td colspan="2" class='f_one'><input name="repassword" id="repassword" class="form" maxLength=12 type="password">
       </td>
     </tr>
     <tr>
       <td class='f_one'>安全提问</td>
       <td colspan="2" class='f_one'>
         <select name="reg[seller_question]">
           <option value="0">&nbsp;</option>
           <option value="母亲的名字">母亲的名字</option>
           <option value="爷爷的名字">爷爷的名字</option>
           <option value="父亲出生的城市">父亲出生的城市</option>
           <option value="您其中一位老师的名字">您其中一位老师的名字</option>
           <option value="您个人计算机的型号">您个人计算机的型号</option>
           <option value="您最喜欢的餐馆名称">您最喜欢的餐馆名称</option>
           <option value="驾驶执照的最后四位数字">驾驶执照的最后四位数字</option>
         </select>
       </td>
     </tr>
     <tr>
       <td class='f_one'>回答</td>
       <td colspan="2" class='f_one'>
         <input type="text" name="reg[seller_answer]" class="input1">
       取回密码时需要提供</td>
     </tr>
     <tr>
       <td class='f_one'>电子邮件<font color=red>*</font></td>
       <td colspan="2" class='f_one'><input name="reg[seller_email_address]" class="form" type="text" id="seller_email_address"></td>
     </tr>
     <tr>
       <td class='f_one'>联系电话<font color=red>*</font></td>
       <td colspan="2" class='f_one'><input name="reg[seller_telephone]" class="form" type="text" id="seller_telephone">
         <span class="fontgrey">取回密码时需要提供</span></td>
     </tr>
     <tr>
       <td class='f_one'>QQ号码</td>
       <td colspan="2" class='f_one'><input name="reg[seller_qq_number]" class="form" type="text" id="seller_qq_number">
      建议添加，以便及时联系</td>
     </tr>
     <tr>
       <td class='f_one'>会员地址</td>
       <td colspan="2" class='f_one'><input name="reg[seller_location]" class="form" type="text" id="seller_location"></td>
     </tr>
     <tr>
       <td  class='f_one'>会员身份证号
         <div align="center">         </div>         <div align="center"></div>         <br>       </td>
       <td colspan="2" class='f_one'><input name="reg[seller_idcard_number]" class="form" type="text" id="seller_idcard_number">
      如果您想提高您的信誉度请添加</td>
     </tr>
     <tr>
       <td  class='f_one'>注册类别</td>
       <td colspan="2" class='f_one'>{section name=key loop=$level}<input type="radio" name="seller_property_id" value="{$level[key][0]}" checked>{$level[key][1]}（{$level[key][2]}）<br>
       {/section} (<a href="index.php?act=Help#2" target="_blank"><font class=blue>帮 助</font></a>) </td>
     </tr>
     <tr>
       <td  class='f_one'>验证码</td>
       <td colspan="2" class='f_one'><input name="acode" type="text" id="acode" size="10">         <img src="source/code.php" /></td>
     </tr>
   </table>
   <div align="center">
     <table width="100%">
       <TR align=center bgcolor="#FFFFFF">
         <TD height="1"></TD>
       </TR>
     </TABLE>
     <input name="code" type="hidden" id="code" value="doReg">
     <input type="submit" id="Submit" name="Submit" value="  提交  ">
   </div>
 </form> {else}
 <form action='' method='post'>
   <input name='code' type='hidden' value='00'><input name='act' value='Reg' type='hidden'>
   <input name="agree" type="hidden" id="agree" value="1">   
   <table width='98%' cellspacing=1 cellpadding=3 bgcolor=#E7E3E7 align=center style='TABLE-LAYOUT: fixed;WORD-WRAP: break-word'>
     <tr>
       <td class=head>注册协议</td>
     </tr>
     <tr>
       <td class=f_one>
       <pre>{$agreement}</pre></td>
     </tr>
   </table>
   <br>
   <center>
     <input name="submit" type='submit' class='bginput' value='同 意'>
     <input name="button" type='button' onclick='javascript:history.go(-1);' value='取消'>
   </center>
 </form>
{/if}
{include file="footer.tpl"}